#pragma once

#include <map>
#include "proxy/common/factory.h"
#include "../common/factory.h"
#include "config.h"


struct Router;
struct Tunnel;

struct Server {

  explicit Server (const Config& cfg);
  ~Server ();

  void run ();
  void shutdown ();

  void addTunnel (Tunnel* tunnel);
  void delTunnel (Tunnel* tunnel);


private:
  const Config& _cfg;
  jlib::RSA _rsa;
  Router* _router;
  s32 _socket;

  List _tunnels;
  std::mutex _mutex;
};